import http.client
import json
import ssl
import requests

if __name__ == '__main__':
    # 创建一个忽略证书验证的 SSL 上下文
    context = ssl._create_unverified_context()
    conn = http.client.HTTPSConnection("cephalon.cloud", context=context)

    d = {
        "model": "Llama-3.1-70B-Instruct",
        "messages": [
                  {
                      "role": "system",
                      "content": "You are a helpful assistant."
                  },
                  {
                      "role": "user",
                      "content": "你好"
                  }
              ],
          }
    payload = json.dumps(d)

    headers = {
        'Authorization': "Bearer 这里替换为你的令牌key",
        'Content-Type': 'application/json'
    }

    conn.request("POST", "/user-center/v1/model/chat/completions", payload, headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
